#ifndef _D3DXINPUT_H__
#define _D3DXINPUT_H__
#include<d3d9.h>
#include<Windows.h>
#include<dinput.h>

#define KEY_DOWN(code) ( IsKeyDown(code) )
#define KEYBOARD_BUFFER_SIZE	1024

class D3DXInput
{
private:
	static D3DXInput* _dinputInstance;

	LPDIRECTINPUT8 _di;
	LPDIRECTINPUTDEVICE8 _keyBoard;

	BYTE KeyStates[256];
	DIDEVICEOBJECTDATA KeyEvents[KEYBOARD_BUFFER_SIZE];
	int _keyUp, _keyDown;
public:
	static D3DXInput* GetInstance();

	D3DXInput();
	bool InitInput(HINSTANCE hInstance, HWND hWnd);
	void ProcessKeyBoard(HWND hWnd);
	int IsKeyDown(int KeyCode);
	int GetKeyDown();
	void SetKeyDown(int key);
	int GetKeyUp();
	char GetKeyState(int key) { return KeyStates[key]; }
	~D3DXInput();
};

#endif